<!DOCTYPE>
<HTML>
<HEAD>
	<meta charset="UTF-8">
	<title></title>
	<link rel="stylesheet" type="text/css" href="../common/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="../common/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="../common/demo.css">
	<script type="text/javascript" src="../common/jquery.min.js"></script>
	<script type="text/javascript" src="../common/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="../common/common.js"></script>
	<script type="text/javascript" src="../common/locale/easyui-lang-zh_CN.js"></script>
	<script type="text/javascript">
    $(document).ready(function(){
        $('#login-window').window({
            //可伸缩箭头
            collapsible:false,
            // 最小化
            minimizable:false,
            // 最大化
            maximizable:false,
            //调整窗口大小
            resizable:false,
            //拖拽操作
            draggable:true,
            //关闭按钮
            closable:false
        });
    });
    document.onkeydown = function(e){
        var event = e || window.event;
        var code = event.keyCode || event.which || event.charCode;
        if (code == 13) {
            login();
        }
    }
    $(function(){
        $("input[name='login']").focus();
    });
    function cleardata(){
        $('#loginForm').form('clear');
    }
    function login(){
         if($("input[name='platForm']").val()=="" || $("input[name='passWord']").val()==""){
             $("#showMsg").html("用户名或密码为空，请输入");
             $("input[name='login']").focus();
        }else{
             $.ajax({
                type:"post",
                url:"/manage/user/login",
                data:$("#loginForm").serialize(),
                error:function(request) {
                    //alert(request.getAttribute("showMsg"));
                    $("#showMsg").html("用户名或密码错误");
                },
                success:function(data) {
                   if(data.code==10000){
                   	 	window.open('/game/index/index.html','_parent');
				   }else if(data.code==20000){
				   		localStorage.setItem('userId',data.message);
                   	 	window.open('/game/index/index1.html','_parent');
				   }else{
						$("#showMsg").html("登陆失败");
				   }

                }
            });

        }
    }
</script>
</HEAD>
<BODY>
<div id="login-window" class="easyui-window" title="登录" style="padding:5px;width:350px;height:248px" >
	<div class="easyui-layout" fit="true">
		<div region="center" border="false" style="padding:5px;background:#fff;border:1px solid #ccc;">
			<form  id="loginForm" method="post" action="">
				<div style="padding:5px 0;">
					<label for="platForm">帐号:</label>
					<input type="text" name="platForm" style="width:260px;"></input>
				</div>
				<div style="padding:5px 0;">
					<label for="passWord">密码:</label>
					<input type="password" name="passWord" style="width:260px;"></input>
				</div>
				<div style="padding:5px 0;text-align: center;color: red;" id="showMsg"></div>
			</form>
		</div>
		<div region="south" border="false" style="text-align:right;padding:5px 0;">
			<a class="easyui-linkbutton" iconCls="icon-ok" href="javascript:void(0)" onclick="login()">登录</a>
			<a class="easyui-linkbutton" iconCls="icon-cancel" href="javascript:void(0)" onclick="cleardata()">重置</a>
		</div>
	</div>
</div>
</BODY>
</HTML>